
function getCurrentDay()
{
	var d = new Date();	
	
	var toDate =	d.getFullYear()+'-'+(d.getMonth()+ 1)+'-'+d.getDate();
	
	return formatDate( toDate);
}

function getPriorMonthDay()
{
	var d = new Date();	
	
	var toDate =	d.getFullYear()+'-'+(d.getMonth()+ 0)+'-'+d.getDate();
	
	return formatDate( toDate);
}

function changeDate(strDate,n)
{
 
	var myDateArray = strDate.split("-");
	
	if (myDateArray.length !=3)
		return '';
	
	var d = new Date(myDateArray[0],myDateArray[1]-1,myDateArray[2]); 
	//alert(d);  ie error
	//var d = new Date( strDate );
	
	
	d.setDate(d.getDate() + n );
	
	var showDate = d.getFullYear()+'-'+(d.getMonth()+ 1)+'-'+d.getDate();
	
	showDate = formatDate (showDate);
    return showDate;
}

/*change data from 2000-1-01 to 2000-01-01*/
function formatDate(strDate)
{
	return strDate.replace(/\b(\w)\b/g, '0$1');
}


function getCurrentMonth()
{
	var d = new Date();	
	
	var toDate =	d.getFullYear()+'-'+(d.getMonth()+ 1) + '-1';
	
	return formatDate( toDate).substring(0,7);
}

function getLastMonth()
{
	var d = new Date();	
	
	var toDate =	d.getFullYear()+'-'+(d.getMonth()) + '-1';
	
	return formatDate( toDate).substring(0,7);
}

function getLastYearMonth()
{
	var d = new Date();	
	
	var toDate =	(d.getFullYear() -1 ) +'-'+(d.getMonth() +1 )  + '-1';
	
	return formatDate( toDate).substring(0,7);
}